package com.grt192.macro;

import com.grt192.core.GRTObject;
import com.grt192.core.controller.Macro;
import com.grt192.networking.SocketEvent;
import com.grt192.networking.SocketListener;
import com.grt192.networking.spot.GRTServant;
import com.grt192.prototyper.PrototyperUtils;
import com.grt192.utils.Util;

public class ServentReadDemo extends GRTObject implements Macro, SocketListener {

	public ServentReadDemo() {
		setPrinting(true);
	}

	public int execute() {

		log("initializing...");
		GRTServant s = new GRTServant(99);
		s.addSocketListenerIn(PrototyperUtils.getAddress(0), this);
		// OutRadio out = s.getServentOut(PrototyperUtils.getAddress(1));

		// hang
		while (true) {
			Util.sleep(9000);
		}
	}

	public void onConnect(SocketEvent e) {

	}

	public void onDisconnect(SocketEvent e) {

	}

	public void dataRecieved(SocketEvent e) {
		log("READ::\t" + e.getData());

	}
}
